package com.example.demo.control;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class myInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if("/login.html".equals(request.getServletPath())){
            return true;
        }
        HttpSession httpSession = request.getSession();
        String count = (String) httpSession.getAttribute("backname");
        if(!count.equals("")){
            return true;
        }
        return false;
    }
}